package cn.stylefeng.guns.modular.business.frequency.orderextrafee.controller;

import cn.stylefeng.guns.core.annotion.BusinessLog;
import cn.stylefeng.guns.core.enums.LogAnnotionOpTypeEnum;
import cn.stylefeng.guns.core.pojo.response.ResponseData;
import cn.stylefeng.guns.core.pojo.response.SuccessResponseData;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import cn.stylefeng.guns.modular.business.frequency.orderextrafee.service.OrderExtraFeeService;
import cn.stylefeng.guns.modular.business.frequency.orderextrafee.model.param.OrderExtraFeeParam;

import javax.annotation.Resource;

/**
 * 订单其他额外费用表 控制器
 *
 * @author: yujie
 * @date: 2023/05/09 17:16
 */
@RestController
public class OrderExtraFeeController {

    @Resource
    private OrderExtraFeeService orderExtraFeeService;

    /**
     * 分页查询订单其他额外费用表
     *
     * @author yujie
     * @date 2023/05/09 17:16
     */
    @GetMapping("/orderExtraFee/page")
    @BusinessLog(title = "订单其他额外费用表_分页查询", opType = LogAnnotionOpTypeEnum.QUERY)
    public ResponseData page(OrderExtraFeeParam orderExtraFeeParam) {
        return new SuccessResponseData(orderExtraFeeService.page(orderExtraFeeParam));
    }

    /**
     * 获取全部订单其他额外费用表
     *
     * @author yujie
     * @date 2023/05/09 17:16
     */
    @GetMapping("/orderExtraFee/list")
    @BusinessLog(title = "订单其他额外费用表_查询所有", opType = LogAnnotionOpTypeEnum.QUERY)
    public ResponseData list(OrderExtraFeeParam orderExtraFeeParam) {
        return new SuccessResponseData(orderExtraFeeService.list(orderExtraFeeParam));
    }

    /**
     * 查看详情订单其他额外费用表
     *
     * @author yujie
     * @date 2023/05/09 17:16
     */
    @GetMapping("/orderExtraFee/detail")
    @BusinessLog(title = "订单其他额外费用表_查看详情", opType = LogAnnotionOpTypeEnum.DETAIL)
    public ResponseData detail(@Validated(OrderExtraFeeParam.detail.class) OrderExtraFeeParam orderExtraFeeParam) {
        return new SuccessResponseData(orderExtraFeeService.detail(orderExtraFeeParam));
    }

    /**
     * 添加订单其他额外费用表
     *
     * @author yujie
     * @date 2023/05/09 17:16
     */
    @PostMapping("/orderExtraFee/add")
    @BusinessLog(title = "订单其他额外费用表_增加", opType = LogAnnotionOpTypeEnum.ADD)
    public ResponseData add(@RequestBody @Validated(OrderExtraFeeParam.add.class) OrderExtraFeeParam orderExtraFeeParam) {
        orderExtraFeeService.add(orderExtraFeeParam);
        return new SuccessResponseData();
    }

    /**
     * 删除订单其他额外费用表
     *
     * @author yujie
     * @date 2023/05/09 17:16
     */
    @PostMapping("/orderExtraFee/delete")
    @BusinessLog(title = "订单其他额外费用表_删除", opType = LogAnnotionOpTypeEnum.DELETE)
    public ResponseData delete(@RequestBody @Validated(OrderExtraFeeParam.delete.class) OrderExtraFeeParam orderExtraFeeParam) {
        orderExtraFeeService.delete(orderExtraFeeParam);
        return new SuccessResponseData();
    }

    /**
     * 编辑订单其他额外费用表
     *
     * @author yujie
     * @date 2023/05/09 17:16
     */
    @PostMapping("/orderExtraFee/edit")
    @BusinessLog(title = "订单其他额外费用表_编辑", opType = LogAnnotionOpTypeEnum.EDIT)
    public ResponseData edit(@RequestBody @Validated(OrderExtraFeeParam.edit.class) OrderExtraFeeParam orderExtraFeeParam) {
        orderExtraFeeService.edit(orderExtraFeeParam);
        return new SuccessResponseData();
    }


}
